package com.iye.puretennis.domain;

import com.iye.puretennis.helper.Constant;

import java.util.LinkedList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: jing wu
 * Date: 2014/12/16
 * Time: 10:34
 */
public class Appointment {

    String guid;

    User owner;

    String location;

    String date;

    String startTime;

    String endTime;

    int participantsAmount;

    String paymentWay;

    String note;

    LinkedList<ListItem> invitations = new LinkedList<ListItem>();

    LinkedList<ListItem> participants = new LinkedList<ListItem>();

    LinkedList<ListItem> requests = new LinkedList<ListItem>();


    boolean operationInvitation;

    boolean sendJoinRequest;

    boolean leave;

    public Appointment() {
    }

    public Appointment(String guid, User owner, String location, String date, String startTime, String endTime, int participantsAmount, String paymentWay, String note, LinkedList<ListItem> invitations, LinkedList<ListItem> participants, LinkedList<ListItem> requests, boolean operationInvitation, boolean sendJoinRequest, boolean leave) {
        this.guid = guid;
        this.owner = owner;
        this.location = location;
        this.date = date;
        this.startTime = startTime;
        this.endTime = endTime;
        this.participantsAmount = participantsAmount;
        this.paymentWay = paymentWay;
        this.note = note;
        this.invitations = invitations;
        this.participants = participants;
        this.requests = requests;
        this.operationInvitation = operationInvitation;
        this.sendJoinRequest = sendJoinRequest;
        this.leave = leave;
    }

    public String getGuid() {
        return guid;
    }

    public User getOwner() {
        return owner;
    }

    public String getLocation() {
        return location;
    }

    public String getDate() {
        return date;
    }


    public String getStartTime() {
        return startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public String getPeriods() {
        return date + " " + startTime + "-" + endTime;
    }

    public int getParticipantsAmount() {
        return participantsAmount;
    }

    public String getPaymentWay() {
        return paymentWay;
    }

    public String getNote() {
        return note;
    }

    public LinkedList<ListItem> getInvitations() {
        return invitations;
    }

    public LinkedList<ListItem> getParticipants() {
        return participants;
    }

    public LinkedList<ListItem> getRequests() {
        return requests;
    }

    public boolean isLeave() {
        return leave;
    }

    public String getOwnerNameLabel(String currentUserGuid) {
        if (currentUserGuid.equals(owner.getGuid())) {
            return Constant.ME;
        }
        return owner.getName();
    }

    public boolean isOperationInvitation() {
        return operationInvitation;
    }

    public boolean isSendJoinRequest() {
        return sendJoinRequest;
    }
}
